// 操作文章数据
import axios from '@/utils/request'

// 1.获取栏目的新闻数据,传递的参数是栏目的id

export const getPostByCateId = (params) =>{
    return axios({
        url:'/post',
        params
    })
}

// 2根据文章id获取文章详情数据
export const getPostById = (id) =>{
    return axios({
        url:`/post/${id}`
    })
}

// 3.根据文章id点赞文章
export const likePostById = (id) =>{
    return axios({
        url:`/post_like/${id}`
    })
}
// 4.根据文章id收藏文章
export const starPostById = (id) =>{
    return axios({
        url:`/post_star/${id}`
    })
}
// 5.根据文章id获取当前文章的评论数据
export const getPostCommentById = (id,params) =>{
    return axios({
        url:`/post_comment/${id}`,
        params
    })
}
// 6.发表文章评论或回复评论
export const pulishComment = (id,data) =>{
    return axios({
        method:'post',
        url:`/post_comment/${id}`,
        data
    })
}
//7.搜索文章
export const searchPost = (params)=>{
    return axios({
        url:'/post_search',
        params
    })
}